<template>
  <div class="home">
    <h2>关于我们组件---{{ comNum }}</h2>
    <button @click="changeNumFn">改变state中的num值</button>
  </div>
</template>

<script>
export default {
  name: "Home",
  components: {},
  computed: {
    comNum() {
      return this.$store.state.num;
    },
  },
  methods: {
    changeNumFn() {
      //提交mutations中的方法
      // this.$store.commit("mutations中定义的方法")
      this.$store.commit("changeNum");
    },
  },
};
</script>
